# Maintainer: Venji10 <bennisteinir@gmail.com>

# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/beryllium_defconfig

pkgname=linux-xiaomi-beryllium-mainline
pkgver=5.2.0
pkgrel=2
pkgdesc="Xiaomi Poco F1 kernel fork, close to mainline"
arch="aarch64"
_carch="arm64"
_flavor="xiaomi-beryllium"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="bison flex perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev openssl-dev"


# Source
_repository="linux-beryllium"
_commit="3ca4b97b596fa220d8511894ee67a34493664a6c"
_config="config-$_flavor.$arch"
source="
	$pkgname-$_commit.tar.gz::https://github.com/Venji10/$_repository/archive/$_commit.tar.gz
	$_config
	linux4.17-gcc10-extern_YYLOC_global_declaration.patch
"
builddir="$srcdir/$_repository-$_commit"

prepare() {
	default_prepare
	REPLACE_GCCH=0 \
		. downstreamkernel_prepare
}

build() {
	unset LDFLAGS
	make ARCH="$_carch" CC="${CC:-gcc}" \
		KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}

package() {
	downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor"
}

sha512sums="4a834f11155b6cb7ca3e7da7f9a561b4f96a2288215ba46cf880f0b95e4ed3ebb5b911d99f1daf7d9e0f2480116e53ffef409e88980fac79026d951f10ef7db3  linux-xiaomi-beryllium-mainline-3ca4b97b596fa220d8511894ee67a34493664a6c.tar.gz
a8a265554eb0bb97ac5929d25faab8b89d4a9d5c0764789ae3679c2455bc97824fbb2ad6f1addeeb3d36a523d434435fd5d5a172c58e01805171bb87b7a2b4f3  config-xiaomi-beryllium.aarch64
27827877040007fc1c4c719f7e2e19e5c272d44972415cfc53feba0313d87e4074f8204bdb13cbc5fe21ea61bf595314b68f10c081e7b7bac3c888b60f008acf  linux4.17-gcc10-extern_YYLOC_global_declaration.patch"
